package com.wenhao.newcode.pinduoduo.hard2020;

import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-07-25 16:22
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int i = 0;i < T;i++) {
            int N = scanner.nextInt();
            if (N == 1) {
                System.out.println("1 1");
            }
            if (N == 2) {
                System.out.println("1 1");
            }
            if (N == 3) {
                System.out.println("0 2");
            }
            if (N > 3) {
                System.out.println("0 " + N);
            }
        }
    }
}
